﻿/********************************************************************************
* Author:	Christos Polydorou	(xristos.polydoroy@gmail.com)					*
* Author:	Aris Michail		(aris.michail@gmail.com)						*
* Date:		22/9/2011															*
********************************************************************************/

CREATE TABLE [dbo].[Users]
(
	ID bigint PRIMARY KEY NOT NULL IDENTITY(1,1),                                           /* Identity of the user */
	Username nvarchar(50) NOT NULL UNIQUE,                                                  /* The username */
	Password nvarchar(50) NOT NULL,                                                         /* User's password */
	Email nvarchar(50) NOT NULL UNIQUE,                                                     /* User's email address */
	Usertype nvarchar(3) NOT NULL DEFAULT('std'),                                           /* The type of the user (eg admin,std) */
	IsEnabled int DEFAULT (0) NOT NULL,                                                     /* 0 if user is enabled */
	TimeLocked datetime NOT NULL,                                                           /* the time when user was locked */
	LoginAttempts int NOT NULL DEFAULT(0),                                                  /* the number of attempts the user tried to log in */
	LastLogin datetime NOT NULL,                                                            /* the time when the user last logged in */
	DateCreated datetime NOT NULL,                                                          /* the date the user was created */
	fname nvarchar(50),
	lname nvarchar(50)
)
